﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using Tasker.Common;
using System.Web.Mvc;

namespace Tasker.WebUI.Models.Profile
{
    public class ProfileShowModel
    {
        public string Login { get; set; }
        public string LastName { get; set; }
        public string FirstName { get; set; }
        public string Position { get; set; }
        public string Comment { get; set; }
        public string PictureName { get; set; }
        public string PictureType { get; set; }

        public string FullName
        {
            get
            {
                if (FirstName == null && LastName == null)
                    return Login;
                return FirstName + " " + LastName;
            }
        }

        public string PicturePath
        {
            get { return Tasker.Common.UrlHelper.GetUserPicturePath(PictureName, PictureType); }
        }

        public string PictureThumbPath
        {
            get { return Tasker.Common.UrlHelper.GetUserPictureThumbPath(PictureName, PictureType); }
        }

        public IEnumerable<string> Emails { get; set; }

        public IEnumerable<string> Phones { get; set; } 
    }

    public class ProfileEditModel
    {
        [Display(Name="Имя")]
        public string FirstName { get; set; }
   
        [Display(Name = "Фамилия")]
        public string LastName { get; set; }

        [Required]
        [Display(Name = "Должность")]
        public string Position { get; set; }

        [Display(Name = "Комментарий")]
        public string Comment { get; set; }

        [DataType(DataType.EmailAddress)]
        public IEnumerable<string> Emails { get; set; }

        [DataType(DataType.PhoneNumber)]
        public IEnumerable<string> Phones { get; set; }

        public string PictureName { get; set; }
        public string PictureType { get; set; }


        public string PicturePath
        {
            get { return Tasker.Common.UrlHelper.GetUserPicturePath(PictureName, PictureType); }
        }

        public string PictureThumbPath
        {
            get { return Tasker.Common.UrlHelper.GetUserPictureThumbPath(PictureName, PictureType); }
        }
    }
}